package com.com.zs21cp.ApiDemo;


import com.com.zs21cp.ToolBean.Event;
import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @program: flink
 * @description:
 * @author: Arctic
 * @create: 2024-02-28 21:58
 */
public class FilterTest {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<Event> source =
                env.fromElements(
                        new Event("Marry","./home",100L),
                        new Event("alice","./home",100L),
                        new Event("Mark","./home",100L),
                        new Event("John","./home",100L)
                );
        source.filter(new FilterFunction<Event>() {
            @Override
            public boolean filter(Event value) throws Exception {
                return value.user.equals("Marry");
            }
        }).print();
        env.execute();
    }
}